function Father(name, age) {
    this.name = name;
    this.age = age;
}

Father.prototype.sing = function() {
    console.log('我们都会唱歌')
}


function Son(name, age, sex) {
    // 继承是通过call来改变this的指向
    Father.call(this, name, age)

    // Son的私有属性
    this.sex = sex;
}



// 方法的继承
// Son.prototype = Father.prototype; // 有问题，两个原型指向同一个指针
Son.prototype = new Father();
Son.prototype.constructor = Son;

Son.prototype.exam = function() {
    console.log("我今年高考")
}

const bo = new Son('波仔', 18, '男')

// console.log(Father.prototype)
console.log(Son.prototype)